const path = require('path');

module.exports = {
  mode: "development",
  entry: {
    admin: './src/js/2.js'
  },
  output: {
    path: path.resolve(__dirname, './build/'),
    filename: 'bundle.min.js'
  },
  module: {
    rules: [
      {test: /\.css$/, use: ['style-loader', 'css-loader', 'postcss-loader']},
      // {test: /\.(png|jpe?g|gif)$/i, loader: 'file-loader', options: {outputPath: 'img/'}}
      {test: /\.(png|jpg|gif)$/i, use: [{loader: 'url-loader', options: {
            limit: 4*1024,
            outputPath: 'img/'
      }}]},
      {test: /\.less$/, use: [{loader: 'style-loader',}, {loader: 'css-loader',}, {loader: 'less-loader'}]},
      {test: /\.jsx?/,exclude: /node_modules/,use: [
          {loader: 'babel-loader', options: {presets: ['@babel/preset-env']}},
          {loader: 'eslint-loader', options: {}}
        ]
      }
    ]
  },
  devtool: "source-map"   //在浏览器查看出错时，保留原始内容，便于查看
};
